package com.crm.system.service.impl;

import com.crm.entity.SysDepartment;
import com.crm.system.mapper.SysDepartmentMapper;
import com.crm.system.service.SysDepartmentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysDepartmentServiceImpl implements SysDepartmentService {
    @Autowired
    private SysDepartmentMapper mapper;


    @Override
    public int add(SysDepartment department) {

        return mapper.Insert(department);
    }

    @Override
    public int remove(String id) {
        return mapper.remove(id);
    }

    @Override
    public PageInfo<SysDepartment> list(int pageIndex, int pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        return new PageInfo<>(mapper.list());
    }

    @Override
    public SysDepartment get(String id) {
        return mapper.get(id);
    }

    @Override
    public int save(SysDepartment department) {
        return mapper.update(department);
    }

    @Override
    public List<String> idInfo(String depId) {
        return mapper.idInfo(depId);
    }


}
